package com.example.pong;

import sheep.game.Sprite;
import sheep.graphics.Image;

public class Player extends Sprite{
	
	private static final Player player = new Player(new Image(R.drawable.racket));
	private final int speed ;
	
	private Player(Image image){
		super(image);
		speed = 150;
	}
	
	public static Player getInstance(){
		return player;
	}
	
	public void setSpeed(float x){
		if(x>this.getPosition().getX()) this.setSpeed(speed, 0);
		else if(x<this.getPosition().getX()) this.setSpeed(-speed, 0);
	}
	public void stopPlayer(){
		this.setSpeed(0, 0);
	}
	
	@Override
	public String toString(){
		return "Player";
	}
}
